package sdu.se;

public class Test {
	private Question[] questions;
	private int current;
	public Test(Question[] q){
		questions=q;
		current=0;
	}
	public Question next(){
		
		current++;
		if(current>=questions.length)current=0;
		return questions[current];
		
	}
	public Question prev(){
		
		current--;
		if(current<0)current=questions.length-1;
		return questions[current];
	}
	public Question at(int i){
		
		if(i<0)current=0;
		else if(i>=questions.length)current=questions.length-1;
		else current=i;
		return questions[current];
		
	}
	public int getPosition(){
		return current;
	}
	public Question getCurrent(){
		return questions[current];
	}
	public Question[] getAll(){
		return questions;
	}
	public void setCurrentMarked(){
		questions[current].marked=true;
		
	}
	public void setCurrentUnmarked(){
		questions[current].marked=false;
		
	}
	public void setCurrentAnswered(){
		questions[current].anwered=true;
		
	}
	public void setAllAnswered(){
		for(int i=0;i<questions.length;i++){
			questions[i].anwered=true;
		}
	}
	public void setMarkCurrent(int i){
		questions[current].choised=i;
	}
}
